<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/base.jsp"%>
<% 
  //实例化AreaDao
  FamilyDao familyDao=new FamilyDao();
  List<Family> familyList=familyDao.findAll();

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/admin.css">
<script type="text/javascript" src="third/laydate/laydate.js"></script>
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//重新绑定表单提交
		$("#add_btn").bind("click", function() {
			$('form').submit();
		});
	});
</script>

</head>

<body>

	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>修改家庭成员档案信息</strong>
		</div>
		<div class="body-content">
			<form id="form-add" method="post" class="form-x"
				action="<%=path%>/system/FamilyMemberServlet?m=add">
				
				<%
					String familycode = request.getParameter("id");
					if (familycode != null){						
				%>
				<div class="form-group">
					<div class="label">
						<label>户内编码：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" style="width: 200px;" value="<%=familycode %>" name="first" id="membercode"
							data-validate="required:请输入户内编码" placeholder="家庭编号" /><input placeholder="-户内编号" name="next" style="width: 110px;" class="input w50" type="text" value="-"/>
						<div class="tips"></div>
					</div>
				</div>
				<%}else{ %>
				<div class="form-group">
					<div class="label">
						<label>选择家庭：</label>
					</div>
					<div class="field">
						<select id="familycode" name="familycode" class="input w50">
							<%
						  for(Family m:familyList){ 
						
						  %>
							<option value="<%=m.getFamilycode()%>">
								<%=m.getFamilycode()%>---<%=m.getFamilyholdername() %></option>
							<%} %>

						</select>


						<div class="tips"></div>
					</div>

				</div>
				
				<div class="form-group">
					<div class="label">
						<label>户内编码：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" style="width: 200px;" value="" name="first" id="membercode"
							data-validate="required:请输入户内编码" placeholder="家庭编号" /><input placeholder="-户内编号" name="next" style="width: 110px;" class="input w50" type="text" value="-"/>
						<div class="tips"></div>
					</div>
				</div>
				<%} %>
				<!-- <div class="form-group">
					<div class="label">
						<label>家庭编码：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" name="familycode"
							data-validate="required:请输入家庭编码" />
						<div class="tips"></div>
					</div>
				</div> -->
		
				<div class="form-group">
					<div class="label">
						<label>农合证号：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" name="cmscode"
							data-validate="required:请输入农合证号" />
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>姓名：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" name="name"
							data-validate="required:请输入姓名" />
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>与户主关系：</label>
					</div>
					<div class="field">
						<select id="relative" name="relative" class="input w50">
						  <option value="">---请选择---</option>
						  <option value="夫妻">夫妻</option>
						  <option value="父女">父女</option>
						  <option value="父子">父子</option>
						  <option value="母子">母子</option>
						  <option value="母女">母女</option>
						  <option value="兄弟">兄弟</option>
						  <option value="兄妹">兄妹</option>
						  <option value="姐妹">姐妹</option>
						  <option value="姐弟">姐弟</option>
						</select>
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>身份证号：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" name="idcard"
							data-validate="required:请输入身份证号" />
						<div class="tips"></div>
					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label>性别：</label>
					</div>
					<div class="field" style="padding-top:8px;">
						男 <input name="sex" value="男" type="radio" checked="checked"/>
						 女 <input name="sex" value="女" type="radio" />

					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label>出生日期：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="1999-04-16" name="birthday" id="birthday"
							data-validate="required:请输入出生日期" />
						<div class="tips"></div>
					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label>民族：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="nation"
							data-validate="required:请输入民族" />
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>健康状况：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="health"
							data-validate="required:请输入健康状况" />
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>文化程度：</label>
					</div>
					<div class="field">
						<select id="educationallevel" name="educationallevel" class="input w50">
						  <option value="">---请选择---</option>
						  <option value="高中">高中</option>
						  <option value="本科及硕士以上">本科及硕士以上</option>
						  <option value="初中及中专">初中及中专</option>
						  <option value="初中以下">初中以下</option>
						</select>
						<div class="tips"></div>
					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label>人员属性：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="memberattribute"
							data-validate="required:请输入人员属性" />
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>是否农业户口：</label>
					</div>
					<div class="field" style="padding-top:8px;">
						是 <input name="farmtype" value="是" type="radio" checked="checked"/>
						 否 <input name="farmtype" value="否" type="radio" />

					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>婚姻状况：</label>
					</div>
					<div class="field" style="padding-top:8px;">
						已婚 <input name="married" value="已婚" type="radio" />
						 未婚 <input name="married" value="未婚" type="radio" checked="checked"/>

					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>工作单位：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" name="workunit"
							data-validate="required:请输入工作单位" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>联系电话：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" value="" name="phone"
							data-validate="required:请输入联系电话" />
						<div class="tips"></div>
					</div>
				</div>
			
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button id="add_btn" class="button bg-main icon-check-square-o"
							type="button">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
<script type="text/javascript">
/*
 * 获取组的编号设置家庭编号
 */
var testSelect = document.getElementById("familycode");
testSelect.onchange = function() { //当选项改变时触发
    var valOption = this.options[this.selectedIndex].value; //获取option的value
    $('#membercode').val(valOption);//放到input的value中
}
</script>

<!--渲染JS日期组件 -->
<script type="text/javascript">
 laydate.render({
  elem: '#birthday'
});
</script>
</body>
</html>
